/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component} from 'react';
import {
  Form, Input, Radio, Select, Icon,
  Upload, Descriptions,
} from 'antd';
import {connect} from 'dva';
import moment from 'moment'
import request from '@/utils/request';
const FormItem = Form.Item;
const { TextArea } = Input;
const RadioGroup = Radio.Group;
const Option = Select.Option;
class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      fileList:[]
    };
  }

  componentDidMount() {
  }
  render() {
    const formItemLayoutWithLabel = {
      labelCol: {
        xs: {span: 24},
        sm: {span: 6},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 15},
      }
    };

    const {getFieldDecorator} = this.props.form;
    const props = {
      listType:'picture-card',
      onRemove: (file) => {
        this.setState(({ fileList }) => {
          const index = fileList.indexOf(file);
          const newFileList = fileList.slice();
          newFileList.splice(index, 1);
          return {
            fileList: newFileList,
          };
        });
      },
      beforeUpload: (file) => {
        this.setState(({ fileList }) => ({
          fileList: [...fileList,file],
        }));
        return false;
      },
      fileList: this.state.fileList,
    };
    return (
      <div>
        <Form>
          <Descriptions  column={4}   className={'blue-descriptions'} title={<div style={{textAlign:'center'}}>完成工单详情</div>} bordered>
            <Descriptions.Item label={<span ><span style={{color:'red',top:'2px',
              position:'relative'}}>* </span> 处理结果</span>} span={4}>
              {getFieldDecorator('process_result', {
                initialValue: '',
                rules: [{ required: true, message: '请输入工单主题' }],
              })(
                <TextArea  rows={3}  />
              )}
            </Descriptions.Item>
            <Descriptions.Item label={<span ><span style={{color:'red',top:'2px',
              position:'relative'}}>* </span> 处理图片</span>} span={4}>
              {getFieldDecorator('process_files', {
                rules: [{required: true, message: '固件文件不能为空'}],
              })(
                <Upload.Dragger {...props}>
                  <p className="ant-upload-text">点击选择图片</p>
                </Upload.Dragger>
              )}
            </Descriptions.Item>
          </Descriptions>
        </Form>
      </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default connect()(AddPoliciesFormWrap);


